from django.db import models

# Create your models here.
#地址信息表
class Area(models.Model):
    areaid  = models.IntegerField(primary_key=True)
    areaname = models.CharField(max_length=50)
    parentid = models.IntegerField()
    arealevel = models.IntegerField()
    status = models.IntegerField()

    class Meta:
        managed = False #False不会在生成表
        db_table = 'area'



class User(models.Model):
      img = models.ImageField(upload_to='static/img/')
      name = models.CharField(max_length=20,verbose_name='昵称')
      sex = models.CharField(max_length=10,verbose_name='性别')
      ega = models.CharField(max_length=100,verbose_name='年龄')
      password = models.CharField(max_length=30,verbose_name='密码')
      email = models.CharField(max_length=30,verbose_name='邮箱')
      phone = models.CharField(max_length=20,verbose_name='手机号')



class Address(models.Model):
    aname = models.CharField(max_length=30,verbose_name='收货人')
    aphone = models.CharField(max_length=30,verbose_name='手机号')
    addr = models.CharField(max_length=30,verbose_name='收货地址')
    isdefault = models.BooleanField(default=False,verbose_name='默认收获地址')
    userinfo = models.ForeignKey(to='User',on_delete=models.CASCADE)


